﻿/// <summary>
/// Author: Le Van Binh
/// Date: 2013/06/06
/// </summary>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using SketchTour.Models;
using Ivs.Core.Mapping;
using Ivs.Core.Common.Utilities;

namespace SketchTour.DAL
{
    public class MSUR00DAL
    {
        private EFBaseDao db;
        public MSUR00DAL()
        {
            db = new EFBaseDao();
        }

        #region Insert
        public int Insert(MSUR00Models dto)
        {
            int returnCode = 0;
            try
            {
                m_user user = new m_user();
                user.UserName = dto.UserName;
                user.PassWord = dto.Password;
                user.FullName = dto.FullName;
                user.RoleID = 1;// dto.RoleID;
                if (dto.IsActive == 1)
                {
                    user.IsActive = true;
                }
                else
                {
                    user.IsActive = false;
                }
                user.CreateDate = DateTime.Now;
                user.CreateBy = dto.CreateBy;
                user.UpdateDate = dto.UpdateDate;
                user.UpdateBy = dto.UpdateBy;
                db.m_user.AddObject(user);
                returnCode = db.Saves();
            }
            catch (Exception ex)
            {
                returnCode = db.ProcessDbException(ex);
            }
            return returnCode;
        }
        #endregion Insert
    }
}